# Name:    CThread.py
# Date:    Sat May  1 19:59:54 CEST 2010
# Purpose: The abstract thread class with callback function.
#          The base class (which inherits CThread) MUST call run method.
#          super(ClassName, self).run()
# Def		  CThread(name)
# Inputs:  name - the name of the thread [string].

import threading

####################################################################################################

class CThread(threading.Thread):
	'''
	'' The abstract thread class with callback function
	'''
	__cbFnc = None

#---------------------------------------------------------------------------------------------------

	def __init__(self, name):
		super(CThread, self).__init__()
		self.setName(name)

#---------------------------------------------------------------------------------------------------

	def setCbFnc(self, cbFunction):
		self.__cbFnc = cbFunction

#---------------------------------------------------------------------------------------------------

	def run(self):
		# print self.getName(),': Callback: ',self.__cbFnc
		if self.__cbFnc is not None:
			self.__cbFnc()

####################################################################################################
